package com.android.fastride.view.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.android.fastride.R;
import com.android.fastride.contract.SetContract;
import com.android.fastride.present.SetPresent;
import com.android.fastride.view.widget.TopBar;
import com.peng.library.mantis.expand.data.MantisDataFragment;
import com.peng.library.mantis.hint.HintConfig;
import com.peng.library.mantis.mvp.BindPresent;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

@BindPresent(SetPresent.class)
public class SetFragment extends MantisDataFragment<SetContract.PRESENT, String> implements
        SetContract.VIEW {

    View view;
    Unbinder unbinder;
    @BindView(R.id.tb_top_bar)
    TopBar tbTopBar;
    @BindView(R.id.rl_position)
    RelativeLayout rlPosition;
    @BindView(R.id.lable_version)
    TextView lableVersion;
    @BindView(R.id.rl_version)
    RelativeLayout rlVersion;
    @BindView(R.id.rl_area)
    RelativeLayout rlArea;
    @BindView(R.id.rl_exit)
    RelativeLayout rlExit;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable
            Bundle savedInstanceState, HintConfig.Builder hintConfigBuilder) {
        view = inflater.inflate(R.layout.fragment_setting, container, false);
        unbinder = ButterKnife.bind(this, view);
        tbTopBar.setOnLeftAndRightClickListener(new TopBar.OnLeftAndRightClickListener() {
            @Override
            public void OnLeftButtonClick() {
                getActivity().finish();
            }

            @Override
            public void OnRightButtonClick() {
            }
        });
        return view;
    }

    @Override
    public void onReceiveData(String s) {

    }

    @Override
    public void onReceiveError(Throwable error) {

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (unbinder != null) {
            unbinder.unbind();
        }
    }

    @OnClick({R.id.rl_position, R.id.rl_version, R.id.rl_area, R.id.rl_exit})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_position:
                // 跳转到我的位置界面
                break;
            case R.id.rl_version:
                // 显示当前版本
                break;
            case R.id.rl_area:
                // 跳转到配送区域设置
                break;
            case R.id.rl_exit:
                // 安全退出
                break;
        }
    }
}
